<div class="view">

	<div class="column">
		<?php
		$src = $data->fileThumbnailUrl;
		$alt = $data->value;
		$htmlOptions = array();
		$text = CHtml::image($src, $alt, $htmlOptions);
		$htmlOptions = array(
			'title'=>"$data->value",
		);
		$haystack = array('language/update', 'language/create');
		if (array_search($this->route, $haystack) !== false) {
			$htmlOptions['rel'] = 'prettyPhoto';
			$url = $data->fileUrl;
		} else {
			$url = $this->createUrl('language/view', array('id'=>$data->id));
		}
		echo CHtml::link($text, $url, $htmlOptions);
		?>
	</div>

	<?php if (!Yii::app()->user->isGuest): ?>
		<div class="right">
			<?php
			$baseUrl = Yii::app()->request->baseUrl . '/images/toolbars';
			$properties = array(
				'items'=>array(
					array(
						'label'=>"<img src=\"$baseUrl/pencil.png\" />",
						'url'=>array('language/update', 'id'=>$data->id),
						'linkOptions'=>array('title'=>'Update'),
						'visible'=>Yii::app()->user->id == 1,
					),
					array(
						'url'=>'#',
						'linkOptions'=>array(
							'submit'=>array(
								'language/delete',
								'id'=>$data->id
							),
							'confirm'=>'Are you sure you want to delete this item?'
						),
						'label'=>"<img src=\"$baseUrl/cross-script.png\" />",
						'visible'=>Yii::app()->user->id == 1,
					),
				),
				'htmlOptions'=>array(
					'class'=>'operations',
				),
				'encodeLabel'=>false,
			);
			$this->widget('zii.widgets.CMenu', $properties);
			?>
		</div>
	<?php endif; ?>

	<div class="left">

		<div class="small top bottom">
			<?php
			$formatter = Yii::app()->dateFormatter;
			echo $formatter->formatDateTime($data->updatedAt, 'full', 'short');
			?>
		</div>

		<b>
			<?php
			echo CHtml::encode(
				$data->page->chapter->manga->getAttributeLabel('title')
			);
			?>:
		</b>
		<?php
		$url = array('manga/view', 'id'=>$data->page->chapter->mangaId);
		echo CHtml::link($data->page->chapter->manga->title, $url);
		?>
		<br />

		<b>
			<?php
			echo CHtml::encode(
				$data->page->chapter->getAttributeLabel('title')
			);
			?>:
		</b>
		<?php
		$url = array('chapter/view', 'id'=>$data->page->chapterId);
		echo CHtml::link($data->page->chapter->title, $url);
		?>
		<br />

		<b>
			<?php
			echo CHtml::encode($data->page->getAttributeLabel('sequence'));
			?>:
		</b>
		<?php
		$text = CHtml::encode($data->page->humanSequence);
		$url = array('page/view', 'id'=>$data->page->id);
		echo CHtml::link($text, $url);
		?>
		<br />

		<b><?php echo CHtml::encode($data->getAttributeLabel('value')); ?>:</b>
		<?php
		$text = CHtml::encode($data->value);
		$url = array('language/view', 'id'=>$data->id);
		echo CHtml::link($text, $url);
		?>
		<br />

		<b><?php echo CHtml::encode($data->getAttributeLabel('name')); ?>:</b>
		<?php echo CHtml::encode($data->uploaderName); ?>
		<br />

		<b>
			<?php echo CHtml::encode($data->getAttributeLabel('viewCount')); ?>:
		</b>
		<?php
		$formatter = Yii::app()->numberFormatter;
		echo $formatter->format('#,##0', $data->viewCount);
		?>&times;


	</div>

	<div class="clear"></div>

</div>

<?php
EPrettyPhoto::register();
$script = '$("a[rel^=\'prettyPhoto\']").prettyPhoto();';
Yii::app()->clientScript->registerScript('prettyPhoto', $script)
?>